#ifndef __FILTER_H__
#define __FILTER_H__

#include <base/base.h>

#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>

using namespace ECG::HAL;

namespace ECG
{
namespace Filter
{
    class CFilter;
    typedef boost::shared_ptr<CFilter> CFilterPtr;

    class CFilter : public CBase
    {
    public:
        virtual bool start()=0;
        //virtual bool encode()=0;
        //virtual bool decode()=0;
        virtual bool filterData(void *data,std::size_t size)=0;
        virtual bool stop()=0;
        void setVar(std::string name)
        {
            outVar = name;
        }
        std::string getVar()
        {
            return outVar;
        }
    protected:
        std::string outVar;
    };

#define registerFilter(clazz)                            \
    extern "C" {                                         \
    boost::shared_ptr<CFilter> createClass()             \
    {                                                    \
        return boost::make_shared<clazz>();              \
    }                                                    \
    void destroyClass(boost::shared_ptr<CFilter> clsPtr) \
    {                                                    \
        clsPtr.reset();                                  \
    }                                                    \
    }
}    
}

#endif //__FILTER_H__